home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula 2
/
Nebula Two.iso
/
SourceCode
/
Tutorial
/
Cookbook
/
13.pie_slice
/
slice.psw
< prev
Wrap
Text File
|
1995-06-12
|
890b
|
47 lines
defineps doLine(float ox, oy, dx, dy)
5 setlinewidth
newpath
ox oy moveto
dx dy rlineto
stroke
endps
defineps doArc(float ox, oy, r, ang1, ang2)
10 setlinewidth
ox oy r ang1 ang2 arc
stroke
endps
defineps drawSlice (float grayshade, radius, startangle, endangle, labelps; char *thelabel)
1 setlinewidth
newpath 0 0 moveto
0 0 radius startangle endangle arc
closepath
1.415 setmiterlimit
gsave
grayshade setgray
fill
grestore
stroke
gsave
startangle endangle add 2 div rotate
radius 0 translate
newpath
0 0 moveto labelps .8 mul 0 lineto stroke
labelps 0 translate
0 0 transform
grestore
itransform
/y exch def /x exch def
x y moveto
x 0 lt
{ (thelabel) stringwidth pop neg 0 rmoveto }
if
y 0 lt { 0 labelps neg rmoveto } if
(thelabel) show
endps